package com.zoe.app.controller;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Console;
import com.zoe.app.entity.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Zoe.Zhang
 * @date 2021/09/25
 * @description
 */
@RestController
public class UserController {

    @GetMapping("/")
    public User user() {
        return User.Builder()
                   .setUserName("小明")
                   .setAge(88)
                   .setBirthday(DateUtil.date())
                   .setAddress("合肥")
                   .setLike("打游戏")
                   .setJob("IT")
                   .setCreateTime(DateUtil.date())
                   .build();
    }

    @PostMapping("/")
    public void saveUser(@RequestBody User user) {
        Console.log(user);
    }
}
